package com.easylinkin.linkappapi.progress.controller;

import com.easylinkin.linkappapi.progress.entity.ProgressImage;
import com.easylinkin.linkappapi.progress.entity.dto.ProgressImageTreeDTO;
import com.easylinkin.linkappapi.progress.service.ProgressImageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import site.morn.rest.RestBuilders;
import site.morn.rest.RestMessage;

import java.util.List;

/**
 * 进度管理/形象进度
 * @author: kan yuanfeng
 * @Date: 2023/04/04 11:42
 * @Description: 形象进度管理
 */
@RestController
@RequestMapping("progressImage")
@Api(tags = "形象进度管理")
public class ProgressImageController {
  
  @Autowired
  private ProgressImageService progressImageService;

  /**
   * @Description: 增加形象进度
   * @author kan yuanfeng
   * @date 2023/04/04 11:42
   */
  @PostMapping
  @ApiOperation("增加形象进度")
  public RestMessage insertList(@RequestBody List<ProgressImage> progressImages){
    progressImageService.insertList(progressImages);
    return RestBuilders.successBuilder().build();
  }

  /**
   * @Description: 查询形象进度列表
   * @author kan yuanfeng
   * @date 2023/04/04 11:42
   */
  @GetMapping("list")
  @ApiOperation("查询形象进度列表")
  public RestMessage queryList(){
    List<ProgressImageTreeDTO> record = progressImageService.queryList();
    return RestBuilders.successBuilder().data(record).build();
  }
}

